home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / SciAn / src / ScianErrors.c < prev    next >
C/C++ Source or Header  |  1994-08-01  |  20KB  |  832 lines

  1. /*ScianErrors.c
  2.   Eric Pepke
  3.   March 26, 1990
  4.   Error routines for scian
  5. */
  6.  
  7. #include "Scian.h"
  8. #include "ScianTypes.h"
  9. #include "ScianNames.h"
  10. #include "ScianIDs.h"
  11. #include "ScianWindows.h"
  12. #include "ScianErrors.h"
  13. #include "ScianDialogs.h"
  14. #include "ScianTimers.h"
  15. #include "ScianArrays.h"
  16. #include "ScianColors.h"
  17. #include "ScianStyle.h"
  18. #include "ScianScripts.h"
  19.  
  20. extern ObjPtr timedObjClass;        /*Timed variable, just in case*/
  21.  
  22. char *IDName(id)
  23. NameTyp id;
  24. /*Returns the internal string of id, or a code giving its number*/
  25. {
  26.     static char emergencyName[40];
  27.     char *retVal;
  28.  
  29.     retVal = GetInternalString(id);
  30.     if (retVal)
  31.     {
  32.     return retVal;
  33.     }
  34.     else
  35.     {
  36.     sprintf(emergencyName, "ID %d", id);
  37.     return emergencyName;
  38.     }
  39. }
  40.  
  41. void OMErr()
  42. /*Out of memory error*/
  43. {
  44.     ReportError("SciAn", "Out of memory!");
  45. }
  46.  
  47. #ifdef PROTO
  48. void VarError(char *whichFunction, int whichError, ObjPtr object, NameTyp var)
  49. #else
  50. void VarError(whichFunction, whichError, object, var)
  51. char *whichFunction;
  52. int whichError;
  53. ObjPtr object;
  54. NameTyp var;
  55. #endif
  56. /*Announces error whichError determined in function whichFunction.
  57.   Additional information may follow whichError*/
  58. {
  59.     ObjPtr name;
  60.  
  61.     switch(whichError)
  62.     {
  63.     case VARNOTFOUND:
  64.         name = GetVar(object, NAME);
  65.         if (name && IsString(name))
  66.         {
  67.         sprintf(tempStr, "Variable %s was not found in object %s",
  68.             IDName(var), GetString(name));
  69.         }
  70.         else
  71.         {
  72.         sprintf(tempStr, "Variable %s was not found", IDName(var));
  73.         }
  74.         break;
  75.     case METHODNOTFOUND:
  76.         name = GetVar(object, NAME);
  77.         if (name && IsString(name))
  78.         {
  79.         sprintf(tempStr, "Method %s was not found in object %s",
  80.             IDName(var), GetString(name));
  81.         }
  82.         else
  83.         {
  84.         sprintf(tempStr, "Method %s was not found in object %lx", IDName(var), object);
  85.         }
  86.         break;
  87.     case VARNOTOBJECT:
  88.         name = GetVar(object, NAME);
  89.         if (name && IsString(name))
  90.         {
  91.         sprintf(tempStr, "Variable %s in object %s is not an object",
  92.             IDName(var), GetString(name));
  93.         }
  94.         else
  95.         {
  96.         sprintf(tempStr, "Variable %s is not an object", IDName(var));
  97.         }
  98.         break;
  99.     case VARNOTARRAY:
  100.         name = GetVar(object, NAME);
  101.         if (name && IsString(name))
  102.         {
  103.         sprintf(tempStr, "Variable %s in object %s is not an array",
  104.             IDName(var), GetString(name));
  105.         }
  106.         else
  107.         {
  108.         sprintf(tempStr, "Variable %s is not an array", IDName(var));
  109.         }
  110.         break;
  111.     case VARNOTPICTURE:
  112.         name = GetVar(object, NAME);
  113.         if (name && IsString(name))
  114.         {
  115.         sprintf(tempStr, "Variable %s in object %s is not a picture",
  116.             IDName(var), GetString(name));
  117.         }
  118.         else
  119.         {
  120.         sprintf(tempStr, "Variable %s is not a picture", IDName(var));
  121.         }
  122.         break;
  123.     case VARNOTWINDOW:
  124.         name = GetVar(object, NAME);
  125.         if (name && IsString(name))
  126.         {
  127.         sprintf(tempStr, "Variable %s in object %s is not a window",
  128.             IDName(var), GetString(name));
  129.         }
  130.         else
  131.         {
  132.         sprintf(tempStr, "Variable %s is not a window", IDName(var));
  133.         }
  134.         break;
  135.     case VARNOTINT:
  136.         name = GetVar(object, NAME);
  137.         if (name && IsString(name))
  138.         {
  139.         sprintf(tempStr, "Variable %s in object %s is not an integer",
  140.             IDName(var), GetString(name));
  141.         }
  142.         else
  143.         {
  144.         sprintf(tempStr, "Variable %s is not an integer", IDName(var));
  145.         }
  146.         break;
  147.     case VARNOTSYMBOL:
  148.         name = GetVar(object, NAME);
  149.         if (name && IsString(name))
  150.         {
  151.         sprintf(tempStr, "Variable %s in object %s is not a symbol",
  152.             IDName(var), GetString(name));
  153.         }
  154.         else
  155.         {
  156.         sprintf(tempStr, "Variable %s is not a symbol", IDName(var));
  157.         }
  158.         break;
  159.     case VARNOTSTRING:
  160.         name = GetVar(object, NAME);
  161.         if (name && IsString(name))
  162.         {
  163.         sprintf(tempStr, "Variable %s in object %s is not a string",
  164.             IDName(var), GetString(name));
  165.         }
  166.         else
  167.         {
  168.         sprintf(tempStr, "Variable %s is not a string", IDName(var));
  169.         }
  170.         break;
  171.     case VARNOTREAL:
  172.         name = GetVar(object, NAME);
  173.         if (name && IsString(name))
  174.         {
  175.         sprintf(tempStr, "Variable %s in object %s is not a real number",
  176.             IDName(var), GetString(name));
  177.         }
  178.         else
  179.         {
  180.         sprintf(tempStr, "Variable %s is not a real number", IDName(var));
  181.         }
  182.         break;
  183.     case VARNOTPALETTE:
  184.         name = GetVar(object, NAME);
  185.         if (name && IsString(name))
  186.         {
  187.         sprintf(tempStr, "Variable %s in object %s is not a palette",
  188.             IDName(var), GetString(name));
  189.         }
  190.         else
  191.         {
  192.         sprintf(tempStr, "Variable %s is not a palette", IDName(var));
  193.         }
  194.         break;
  195.     case VARNOTLIST:
  196.         name = GetVar(object, NAME);
  197.         if (name && IsString(name))
  198.         {
  199.         sprintf(tempStr, "Variable %s in object %s is not a list",
  200.             IDName(var), GetString(name));
  201.         }
  202.         else
  203.         {
  204.         sprintf(tempStr, "Variable %s is not a list", IDName(var));
  205.         }
  206.         break;
  207.     case VARBADRANK:
  208.         name = GetVar(object, NAME);
  209.         if (name && IsString(name))
  210.         {
  211.         sprintf(tempStr, "The rank of variable %s in object %s is wrong",
  212.             IDName(var), GetString(name));
  213.         }
  214.         else
  215.         {
  216.         sprintf(tempStr, "The rank of variable %s is wrong", IDName(var));
  217.         }
  218.         break;
  219.     case VARBADDIM:
  220.         name = GetVar(object, NAME);
  221.         if (name && IsString(name))
  222.         {
  223.         sprintf(tempStr, "The dimensions of variable %s in object %s are wrong",
  224.             IDName(var), GetString(name));
  225.         }
  226.         else
  227.         {
  228.         sprintf(tempStr, "The dimensions of variable %s are wrong", IDName(var));
  229.         }
  230.         break;
  231.     default:
  232.         sprintf(tempStr, "Unrecognized error %d", whichError);
  233.         break;
  234.     }
  235.     ReportError(whichFunction, tempStr);
  236. }
  237.  
  238. void Error(whichFunction, whichError, extraInfo)
  239. char *whichFunction;
  240. int whichError;
  241. char *extraInfo;
  242. /*Announces error whichError determined in function whichFunction.
  243.   Additional information may follow whichError*/
  244. {
  245.     switch(whichError)
  246.     {
  247.     case CREATEFILEERROR:
  248.         /*Error creating a file*/
  249.         sprintf(tempStr, "Failed to create or open file %s for writing",
  250.             extraInfo);
  251.         break;
  252.     case OPENFILEERROR:
  253.         /*Error creating a file*/
  254.         sprintf(tempStr, "File %s does not exist or could not be opened",
  255.             extraInfo);
  256.         break;
  257.     default:
  258.         sprintf(tempStr, "Unrecognized error %d", whichError);
  259.         break;
  260.     }
  261.     ReportError(whichFunction, tempStr);
  262. }
  263.  
  264. ObjPtr GetVarSurely(whichFunction, object, var)
  265. char *whichFunction;
  266. ObjPtr object;
  267. NameTyp var;
  268. /*Gets var from object.  If it is an object, returns it.  If not, prints
  269.   error as if from function whichFunction.  If object is 0, returns 0, so this
  270.   can be used in a dataflow sort of way*/
  271. {
  272.     ObjPtr retVal;
  273.     if (!object)
  274.     {
  275.     return NULLOBJ;
  276.     }
  277.     retVal = GetVar(object, var);
  278.     if (!retVal)
  279.     {
  280.     VarError(whichFunction, VARNOTFOUND, object, var);
  281.     return NULLOBJ;
  282.     }
  283.     return retVal;
  284. }
  285.  
  286. ObjPtr GetObjectVar(whichFunction, object, var)
  287. char *whichFunction;
  288. ObjPtr object;
  289. NameTyp var;
  290. /*Gets var from object.  If it is an object, returns it.  If not, prints
  291.   error as if from function whichFunction.  If object is 0, returns 0, so this
  292.   can be used in a dataflow sort of way*/
  293. {
  294.     ObjPtr retVal;
  295.     if (!object)
  296.     {
  297.     return NULLOBJ;
  298.     }
  299.     retVal = GetVar(object, var);
  300.     if (!retVal)
  301.     {
  302.     VarError(whichFunction, VARNOTFOUND, object, var);
  303.     return NULLOBJ;
  304.     }
  305.     if (!IsObject(retVal))
  306.     {
  307.     VarError(whichFunction, VARNOTOBJECT, object, var);
  308.     return NULLOBJ;
  309.     }
  310.     return retVal;
  311. }
  312.  
  313. ObjPtr GetListVar(whichFunction, object, var)
  314. char *whichFunction;
  315. ObjPtr object;
  316. NameTyp var;
  317. /*Gets var from object.  If it is a list, returns it.  If not, prints
  318.   error as if from function whichFunction.  If object is 0, returns 0, so this
  319.   can be used in a dataflow sort of way*/
  320. {
  321.     ObjPtr retVal;
  322.     if (!object)
  323.     {
  324.     return NULLOBJ;
  325.     }
  326.     retVal = GetVar(object, var);
  327.     if (!retVal)
  328.     {
  329.     VarError(whichFunction, VARNOTFOUND, object, var);
  330.     return NULLOBJ;
  331.     }
  332.     if (!IsList(retVal))
  333.     {
  334.     VarError(whichFunction, VARNOTLIST, object, var);
  335.     return NULLOBJ;
  336.     }
  337.     return retVal;
  338. }
  339.  
  340. ObjPtr GetPictureVar(whichFunction, object, var)
  341. char *whichFunction;
  342. ObjPtr object;
  343. NameTyp var;
  344. /*Gets var from object.  If it is a picture, returns it.  If not, prints
  345.   error as if from function whichFunction.  If object is 0, returns 0, so this
  346.   can be used in a dataflow sort of way*/
  347. {
  348.     ObjPtr retVal;
  349.     if (!object)
  350.     {
  351.     return NULLOBJ;
  352.     }
  353.     retVal = GetVar(object, var);
  354.     if (!retVal)
  355.     {
  356.     VarError(whichFunction, VARNOTFOUND, object, var);
  357.     return NULLOBJ;
  358.     }
  359.     if (!IsPicture(retVal))
  360.     {
  361.     VarError(whichFunction, VARNOTPICTURE, object, var);
  362.     return NULLOBJ;
  363.     }
  364.     return retVal;
  365. }
  366.  
  367. ObjPtr GetWindowVar(whichFunction, object, var)
  368. char *whichFunction;
  369. ObjPtr object;
  370. NameTyp var;
  371. /*Gets var from object.  If it is a window, returns it.  If not, prints
  372.   error as if from function whichFunction.  If object is 0, returns 0, so this
  373.   can be used in a dataflow sort of way*/
  374. {
  375.     ObjPtr retVal;
  376.     if (!object)
  377.     {
  378.     return NULLOBJ;
  379.     }
  380.     retVal = GetVar(object, var);
  381.     if (!retVal)
  382.     {
  383.     VarError(whichFunction, VARNOTFOUND, object, var);
  384.     return NULLOBJ;
  385.     }
  386.     if (!IsWindow(retVal))
  387.     {
  388.     VarError(whichFunction, VARNOTWINDOW, object, var);
  389.     return NULLOBJ;
  390.     }
  391.     return retVal;
  392. }
  393.  
  394.  
  395. ObjPtr GetArrayVar(whichFunction, object, var)
  396. char *whichFunction;
  397. ObjPtr object;
  398. NameTyp var;
  399. /*Gets var from object.  If it is an array, returns it.  If not, prints
  400.   error as if from function whichFunction.  If object is 0, returns 0, so this
  401.   can be used in a dataflow sort of way*/
  402. {
  403.     ObjPtr retVal;
  404.  
  405.     if (!object)
  406.     {
  407.     return NULLOBJ;
  408.     }
  409.     retVal = GetVar(object, var);
  410.     if (!retVal)
  411.     {
  412.     VarError(whichFunction, VARNOTFOUND, object, var);
  413.     return NULLOBJ;
  414.     }
  415.     if (!IsRealArray(retVal))
  416.     {
  417.     VarError(whichFunction, VARNOTARRAY, object, var);
  418.     return NULLOBJ;
  419.     }
  420.     return retVal;
  421. }
  422.  
  423. FuncTyp GetMethodSurely(whichFunction, object, method)
  424. char *whichFunction;
  425. ObjPtr object;
  426. NameTyp method;
  427. /*Gets method from object.  If it is there, returns it.  If not, prints
  428.   error as if from function whichFunction.  If object is 0, returns 0, so this
  429.   can be used in a dataflow sort of way
  430.  
  431.   And don't call me surely.
  432. */
  433. {
  434.     FuncTyp retVal;
  435.  
  436.     if (!object)
  437.     {
  438.     return 0;
  439.     }
  440.     retVal = GetMethod(object, method);
  441.     if (!retVal)
  442.     {
  443.     VarError(whichFunction, METHODNOTFOUND, object, method);
  444.     return 0;
  445.     }
  446.     return retVal;
  447. }
  448.  
  449. ObjPtr GetIntVar(whichFunction, object, var)
  450. char *whichFunction;
  451. ObjPtr object;
  452. NameTyp var;
  453. /*Gets var from object.  If it is an int, returns it.  If not, prints
  454.   error as if from function whichFunction.  If object is 0, returns 0, so this
  455.   can be used in a dataflow sort of way*/
  456. {
  457.     ObjPtr retVal;
  458.  
  459.     if (!object)
  460.     {
  461.     return NULLOBJ;
  462.     }
  463.     retVal = GetVar(object, var);
  464.     if (!retVal)
  465.     {
  466.     VarError(whichFunction, VARNOTFOUND, object, var);
  467.     return NULLOBJ;
  468.     }
  469.     if (!IsInt(retVal))
  470.     {
  471.     VarError(whichFunction, VARNOTINT, object, var);
  472.     return NULLOBJ;
  473.     }
  474.     return retVal;
  475. }
  476.  
  477. ObjPtr GetSymbolVar(whichFunction, object, var)
  478. char *whichFunction;
  479. ObjPtr object;
  480. NameTyp var;
  481. /*Gets var from object.  If it is a symbol, returns it.  If not, prints
  482.   error as if from function whichFunction.  If object is 0, returns 0, so this
  483.   can be used in a dataflow sort of way*/
  484. {
  485.     ObjPtr retVal;
  486.  
  487.     if (!object)
  488.     {
  489.     return NULLOBJ;
  490.     }
  491.     retVal = GetVar(object, var);
  492.     if (!retVal)
  493.     {
  494.     VarError(whichFunction, VARNOTFOUND, object, var);
  495.     return NULLOBJ;
  496.     }
  497.     if (!IsSymbol(retVal))
  498.     {
  499.     VarError(whichFunction, VARNOTSYMBOL, object, var);
  500.     return NULLOBJ;
  501.     }
  502.     return retVal;
  503. }
  504.  
  505. ObjPtr GetStringVar(whichFunction, object, var)
  506. char *whichFunction;
  507. ObjPtr object;
  508. NameTyp var;
  509. /*Gets var from object.  If it is a string, returns it.  If not, prints
  510.   error as if from function whichFunction.  If object is 0, returns 0, so this
  511.   can be used in a dataflow sort of way*/
  512. {
  513.     ObjPtr retVal;
  514.  
  515.     if (!object)
  516.     {
  517.     return NULLOBJ;
  518.     }
  519.     retVal = GetVar(object, var);
  520.     if (!retVal)
  521.     {
  522.     VarError(whichFunction, VARNOTFOUND, object, var);
  523.     return NULLOBJ;
  524.     }
  525.     if (!IsString(retVal))
  526.     {
  527.     VarError(whichFunction, VARNOTSTRING, object, var);
  528.     return NULLOBJ;
  529.     }
  530.     return retVal;
  531. }
  532.  
  533. ObjPtr GetRealVar(whichFunction, object, var)
  534. char *whichFunction;
  535. ObjPtr object;
  536. NameTyp var;
  537. /*Gets var from object.  If it is a real, returns it.  If not, prints
  538.   error as if from function whichFunction.  If object is 0, returns 0, so this
  539.   can be used in a dataflow sort of way*/
  540. {
  541.     ObjPtr retVal;
  542.  
  543.     if (!object)
  544.     {
  545.     return NULLOBJ;
  546.     }
  547.     retVal = GetVar(object, var);
  548.     if (!retVal)
  549.     {
  550.     VarError(whichFunction, VARNOTFOUND, object, var);
  551.     return NULLOBJ;
  552.     }
  553.     if (!IsReal(retVal))
  554.     {
  555.     VarError(whichFunction, VARNOTREAL, object, var);
  556.     return NULLOBJ;
  557.     }
  558.     return retVal;
  559. }
  560.  
  561. ObjPtr GetPaletteVar(whichFunction, object, var)
  562. char *whichFunction;
  563. ObjPtr object;
  564. NameTyp var;
  565. /*Gets var from object.  If it is a palette, returns it.  If not, prints
  566.   error as if from function whichFunction.  If object is 0, returns 0, so this
  567.   can be used in a dataflow sort of way*/
  568. {
  569.     ObjPtr retVal;
  570.  
  571.     if (!object)
  572.     {
  573.     return NULLOBJ;
  574.     }
  575.     retVal = GetVar(object, var);
  576.     if (!retVal)
  577.     {
  578.     VarError(whichFunction, VARNOTFOUND, object, var);
  579.     return NULLOBJ;
  580.     }
  581.     if (!IsPalette(retVal))
  582.     {
  583.     VarError(whichFunction, VARNOTPALETTE, object, var);
  584.     return NULLOBJ;
  585.     }
  586.     return retVal;
  587. }
  588.  
  589. #ifdef PROTO
  590. ObjPtr GetFixedArrayVar(char *whichFunction, ObjPtr object, 
  591.     NameTyp var, int rank, ...) 
  592. #else
  593. ObjPtr GetFixedArrayVar(whichFunction, object, var, rank)
  594. char *whichFunction;
  595. ObjPtr object;
  596. NameTyp var;
  597. int rank;
  598. #endif
  599. /*Gets var from object.  If it is an array and conforms to rank and
  600.   the following dimensions, returns it.  If not, prints error as if from 
  601.   function whichFunction.  If object is 0, returns 0, so this
  602.   can be used in a dataflow sort of way*/
  603. {
  604.     ObjPtr retVal;
  605.     long *dims;
  606.     int k;
  607.  
  608.     dims = (long *)(&rank + 1);
  609.  
  610.     if (!object)
  611.     {
  612.     return NULLOBJ;
  613.     }
  614.     retVal = GetVar(object, var);
  615.     if (!retVal)
  616.     {
  617.     VarError(whichFunction, VARNOTFOUND, object, var);
  618.     return NULLOBJ;
  619.     }
  620.     if (!IsRealArray(retVal))
  621.     {
  622.     VarError(whichFunction, VARNOTARRAY, object, var);
  623.     return NULLOBJ;
  624.     }
  625.     if (rank != RANK(retVal))
  626.     {
  627.     VarError(whichFunction, VARBADRANK, object, var);
  628.     return NULLOBJ;
  629.     }
  630.     for (k = 0; k < rank; ++k)
  631.     {
  632.     if (*dims != DIMS(retVal)[k])
  633.     {
  634.         VarError(whichFunction, VARBADDIM, object, var);
  635.         return NULLOBJ;
  636.     }
  637.     ++dims;
  638.     }
  639.     return retVal;
  640. }
  641.  
  642. Bool GetPredicate(object, var)
  643. ObjPtr object;
  644. NameTyp var;
  645. /*Checks predicate var in object*/
  646. {
  647.     ObjPtr value;
  648.     value = GetVar(object, var);
  649.     if (value && IsInt(value) && GetInt(value))
  650.     {
  651.     return true;
  652.     }
  653.     else
  654.     {
  655.     return false;
  656.     }
  657. }
  658.  
  659. Bool IntVarEql(object, var, value)
  660. ObjPtr object;
  661. NameTyp var;
  662. int value;
  663. /*Returns true iff object has an integer variable var which has value value,
  664.   false otherwise*/
  665. {
  666.     ObjPtr varval;
  667.     if (!object)
  668.     {
  669.     return false;
  670.     }
  671.     varval = GetVar(object, var);
  672.     if (varval && IsInt(varval))
  673.     {
  674.     return GetInt(varval) == value ? true : false;
  675.     }
  676.     else
  677.     {
  678.     return false;
  679.     }
  680. }
  681.  
  682. /*
  683.   A warning is a kind of alert which only exists to give information to
  684.   the user.  The user can read the alert and dismiss it; that's all.
  685.  
  686.   Unlike general alerts, warning alerts are not saved in scripts.
  687.   When a log is being made, no user interface operations to the alert window
  688.   are saved to the log.  When a script is being read, warnings do not appear
  689.   in alert boxes but are rather sent to stderr.
  690. */
  691.  
  692. int warningsToDo[MAXNWARNINGS];
  693. int curWarning = 0;
  694.  
  695. static void EmitWarnings()
  696. /*Emits all the warnings in the stack*/
  697. {
  698.     int k;
  699.     int color;
  700.     char *message;
  701.  
  702.     color = UICAUTIONALERT;
  703.     message = "An unknown error occurred.";
  704.  
  705.     for (k = 0; k < curWarning; ++k)
  706.     {
  707.     switch (warningsToDo[k])
  708.     {
  709.         case CW_NUMBERERROR:
  710.         color = UIERRORALERT;
  711.         message = "There is a syntax error in the number you have just entered.  \
  712. Please enter the number once more.";
  713.         break;
  714.         case CW_NONINTERROR:
  715.         color = UIERRORALERT;
  716.         message = "You have entered a real number.  This number must be an integer.  \
  717. Please enter the number once more.";
  718.         break;
  719.         case CW_INFINITYERROR:
  720.         color = UIERRORALERT;
  721.         message = "The number entered may not be infinite.  \
  722. Please enter the number once more.";
  723.         break;
  724.         case CW_MISSINGERROR:
  725.         color = UIERRORALERT;
  726.         message = "The number entered may not be missing.  \
  727. Please enter the number once more.";
  728.         break;
  729.         case CW_NOTPALETTEERROR:
  730.         color = UIERRORALERT;
  731.         message =  "Only palettes can be dropped in this icon corral.";
  732.         break;
  733.         case CW_FILEFORMATERROR:
  734.         color = UIERRORALERT;
  735.         message = "The file you have selected does not have a format \
  736. recognized by SciAn.  If you know the format of the file, set it with Set Format \
  737. and try again.";
  738.         break;
  739.         case CW_READDIRERROR:
  740.         color = UIERRORALERT;
  741.         message = "Entire directories cannot be read as files into SciAn.  \
  742. Please go into the directory, select the files you want to open, and try again.";
  743.         break;
  744.         case CW_NOTOGETHERMODIFY:
  745.         color = UIERRORALERT;
  746.         message = "There is no modifier which can modify the selected datasets together.";
  747.         break;
  748.         case CW_NOSEPARATEMODIFY:
  749.         color = UIERRORALERT;
  750.         message = "There is no modifier which can modify the selected dataset.";
  751.         break;
  752.         case CW_CANNOTVISFILE:
  753.         color = UIERRORALERT;
  754.         message = "Files cannot be visualized directly.  Please open the file and \
  755. then visualize the resulting datasets.";
  756.         break;
  757.         case CW_CANNOTVISERROR:
  758.         color = UIERRORALERT;
  759.         message = "Some of the selected objects could not be visualized directly.  \
  760. Try Visualize As.";
  761.         break;
  762.         case CW_LOOKATERROR:
  763.         color = UIERRORALERT;
  764.         message = "The lookat point must be different from the position of \
  765. the observer.";
  766.         break;
  767.         case CW_NOGEOMETRYERROR:
  768.         color = UIERRORALERT;
  769.         message = "A geometric dataset is not appropriate here.  Use a numeric \
  770. field instead.";
  771.         break;
  772.         case CW_CANNOTDROPINMAIN:
  773.         color = UIERRORALERT;
  774.         message = "Once a visualization object has been generated, its \
  775. main dataset cannot be changed.  Create a new visualization object of the same \
  776. type with the new dataset.";
  777.         break;
  778.         case CW_SCRSAVEFAILED:
  779.         color = UIERRORALERT;
  780.         message = "The attempt to save the screen failed.  This is probably \
  781. because of insufficient privileges in the directory or a full disk.";
  782.         break;
  783.         case CW_OPENERROR:
  784.         color = UIERRORALERT;
  785.         message = "Unable to access file.";
  786.         break;
  787.         case CW_CHDIRERROR:
  788.         color = UIERRORALERT;
  789.         message = "Unable to access directory.";
  790.         break;
  791.         case CW_PATHTOOLONGERROR:
  792.         color = UIERRORALERT;
  793.         message = "Could not open the folder because the path name is too long.";
  794.         break;
  795.         case CW_NOSCREENSAVER:
  796.         color = UIERRORALERT;
  797.         message = "No screen saving object is enabled.  Check the Preferences.";
  798.         break;
  799.         case CW_SCREENSAVEERROR:
  800.         color = UIERRORALERT;
  801.         message = "There was an error while saving the screen.";
  802.         break;
  803.     }
  804.     }
  805.  
  806.     if (runningScript)
  807.     {
  808.     fprintf(stderr, "The following error occured while reading the script\n(It is probably safe to ignore):\n");
  809.     fprintf(stderr, "%s\n", message);
  810.     }
  811.     else
  812.     {
  813.     WinInfoPtr errWindow;
  814.     errWindow = AlertUser(UIERRORALERT, (WinInfoPtr) 0, message, 0, 0, "");
  815.     SetVar((ObjPtr) errWindow, INHIBITLOGGING, ObjTrue);
  816.     }
  817.     curWarning = 0;
  818. }
  819.  
  820. #ifdef PROTO
  821. void WarnUser(int warning)
  822. #else
  823. void WarnUser(warning)
  824. int warning;
  825. #endif
  826. /*Warns a user with warning*/
  827. {
  828.     if (curWarning >= MAXNWARNINGS) return;
  829.     warningsToDo[curWarning++] = warning;
  830.     DoUniqueTask(EmitWarnings);
  831. }
  832.